<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;


use Request;
use DB;

class IndexController extends Controller
{
    public function login(){

        return view('home.index.login');
    }

    public function index(){
        $blog_m = Model("Blog");
        $keyword = Request::input("keyword");
        $cate = Request::input("cate");
        $tag = Request::input("tag");
        //DB::connection()->enableQueryLog();
        $blogList = $blog_m->getBlogList(15,$keyword,$cate,$tag);
        if($blog_m->getLastId($keyword,$cate,$tag))
            $blogInfo = $blog_m->blogInfo($blog_m->getLastId($keyword,$cate,$tag)->id);
        else
            $blogInfo = '';
        $data['blogList'] = $blogList;
        $data['lastBlogInfo'] = $blogInfo;
        $data['keyword'] = $keyword;

        //这里为查询操作
        //dump(DB::getQueryLog());
    	return view('home.index.index',$data);
    }

    public function show(){
        return view('home.index.show');
    }

    public function myPage(){
        return view('home.index.my_page');
    }

    public function office(){
        return "office";
    }
}
